package com.asa.physics;

import com.asa.physics.bean.XYZT;

public class Func {

	public static XYZT to(XYZT xyzt) {
		
		 
		XYZT xtzt2 = new XYZT();
		
		long x = xyzt.x;
		long y = xyzt.y;
		long z = xyzt.z;
		long xt = xyzt.xt;
		long yt = xyzt.yt;
		long zt = xyzt.zt;
		
		long vx = xyzt.vx;
		long vy = xyzt.vy;
		long vz = xyzt.vz;

		
		
		xtzt2.x = toDistance(x, xt, vx);
		xtzt2.y = toDistance(y, yt, vy);
		xtzt2.z = toDistance(z, zt, vz);

		xtzt2.xt = toTime(x, xt, vx);
		xtzt2.yt = toTime(y, yt, vy);
		xtzt2.zt = toTime(z, zt, vz);
		
		
		return xtzt2;
		
	}
	
	
	
	
	public static long toDistance(long x,long t,long v) {
		
		long x2 = (long) ((x-v*t)/Math.sqrt(1-Math.pow(v/Constant.c, 2)));

		return x2;
		
	}
	
	
	
	public static long toTime(long x,long t,long v) {
		
		long t2 = (long) ((t-v/(Constant.c*Constant.c)*x)/Math.sqrt(1-Math.pow(v/Constant.c, 2)));

		return t2;
		
	}
	
	
	
	
	
	
	
	
	
	
}
